<DOCTYPE html>
<html>
<head>
    <title>聚惠家</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php foreach ($this->config->item('style_css_paths') as $css): ?>
      <link rel="stylesheet" href=<?php echo $css ?> />
    <?php endforeach ?>
    <?php foreach ($this->config->item('style_js_paths') as $js): ?>
      <script type="text/javascript" src=<?php echo $js?> ></script>
    <?php endforeach ?>
    <!-- bxSlider Javascript file -->
    <script src=<?php echo base_url("/scripts/jquery.bxslider.min.js") ?>></script>
    <!-- bxSlider CSS file -->
    <link href=<?php echo base_url("/scripts/jquery.bxslider.css") ?>  rel="stylesheet" />
    <script type="text/javascript" src=<?php echo base_url("/scripts/logic/uihelper.js") ;?>></script>
</head>
 
<body>
      <div data-role="page" id="shop"> 

        <div data-role="header" style="overflow:hidden;" data-tap-toggle="false" data-position="fixed">
            <!-- <h1>店铺</h1> -->
            <div data-role="navbar">
                <ul>
                    <li><a href=<?php echo site_url('welcome/shop') ;?> class="ui-btn-icon-right ui-icon-shop" >外卖</a></li>
                    <li><a href=<?php echo site_url('grouppurchase') ; ?> class="ui-btn-active ui-btn-icon-right ui-icon-grid" >团购</a></li>
                </ul>
            </div><!-- /navbar -->
        </div><!-- /header -->       

        <div role="main" class="ui-content">
          <div id="groupplist" data-inset="true">
            <ul data-role="listview" id="grouplisttab" data-inset="true">
            <li data-role="divider">团购列表</li>
            <?php foreach ($groups as $item): 
                    // 是否已售完
                    $isSoldOut = False;
                    if ($item["buy_num"] >= $item["group_capacity"] or $item["user_num"] >= $item["user_capacity"])
                    {
                      $isSoldOut = True;
                    }
            ?>
              <li>
                  <a href=<?php echo site_url('grouppurchase/groupdetail?group_id=') . $item["group_id"] ; ?>>
                      <img src="<?php echo base_url($item["logo_pic"]); ?>"/>
                      <h2><?php if ($isSoldOut) echo "[售完]";?><?php echo $item["group_name"];?></h2>
                      <p><?php echo $item["brief_des"];?></p>
                  </a>
              </li>
            <?php endforeach ?>
           </ul>
          </div>
        </div>  

        <div data-role="footer" data-tap-toggle="false" data-position="fixed">
            <div data-role="navbar">
              <ul>
                <li><a href=<?php echo site_url('welcome');?> data-icon="home">主页</a></li>
                <li><a href=<?php echo site_url("welcome/shop") ;?> data-icon="shop" class="ui-btn-active ui-state-persist">店铺</a></li>
                <li><a href=<?php echo site_url('welcome/history');?>  data-icon="check">历史订单</a></li>
                <li><a href=<?php echo site_url("welcome/info") ;?> data-icon="info">个人信息</a></li>
              </ul>
            </div>
        </div>
    </div>
</body> 
</html>

